03. Building and Running
Building and Running
To get started with your project, you can download the code from the GitHub repo here , or you can use the workspace provided below. If you decide to work on this project on your local machine, you will need to install the dependencies outlined in the GitHub README for the project.
In this classroom concept, you will see the instructions for building, running, and testing your project. In the next classroom concept, you will see a detailed overview of the project code, so you'll be well prepared to start work on the project.
Building
This project will use CMake as the build system. Building the project code can be done from the terminal workspace or from the virtual desktop workspace. It is also possible to build this project locally. To do this, you will need to install the project dependencies in your local environment, including the IO2D library, which can be difficult. The complete list of dependencies can be found in the GitHub README for the project.
Building Using Udacity Workspaces
You can use either of the following ways to build the project using Udacity workspace:
- Using the terminal workspace.
- Using the virtual desktop by clicking on the "Desktop" button. If using the virtual desktop, you will want to use a terminal from within VS Code , as the correct compiler options have been set up in the VS Code preferences. See the video below for a walkthrough of how to do this.
Project Build
The video above demonstrates building the project in the virtual desktop. To follow along, be sure to click on the "Desktop" button in your workspace to open a virtual desktop window:
In the workspace desktop, you can open Visual Studio Code and a terminal within Visual Studio. To build the code, make a
build
directory and then
cd
into that directory. From within the
build
directory, you can then run the following commands to compile:
cmake ..
make
Running
Once the build is complete, the executable binary files will be in the
build
folder of the project, and the project will be ready to run.
Run
Running the project must be done from the workspace desktop in order for you to be able to see the mapped output. In the terminal, navigate to the build folder. From the
build
directory, you can run the compiled executable with map data using the following command:
./OSM_A_star_search
Or to specify a map file:
./OSM_A_star_search -f ../<your_osm_file.osm>
When you run the project for the first time, you should see a blank map like the one below:
When running the project code for the first time, you should see a map like the one above.
Project Workspace
Be sure to try this yourself in the workspace below or locally on your own machine!
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: react
- Opened files (when workspace is loaded): n/a
-
userCode:
export CXX=g++-7
export CXXFLAGS=-std=c++17
Task Feedback:
Great work! You can now try running the tests for the project in the next concept.